import Common from '../../common/common.js';
import GroupList from './GroupList.js';
import {CreateGroupWin} from './GroupWin.js';

const doms = {
    addGroup: Common.tool.getElementByID("addGroup"),
    groupList:Common.tool.getElementByID("groupList")
}

const groupList = new GroupList();



const setGroupList = function(list){
    groupList.updateData(list)
}


Common.tool.addHandle(doms.addGroup,"click",()=>{
    let win = new CreateGroupWin();
    win.open();
});

doms.groupList.appendChild(groupList.getElement());

const clear = function(){
    groupList.clearItems();
}

export default {
    setGroupList:setGroupList,
    clear:clear
 };
